<include file="public@header" />
</head>

<body>
    <div class="wrap js-check-wrap">
        <ul class="nav nav-tabs">
            <li class="active"><a href="javascript:;">所有汽车</a></li>
            <li><a href="{:url('AdminCar/add')}">添加汽车</a></li>
        </ul>
        <form class="well form-inline margin-top-20" method="post" action="{:url('AdminCar/index')}">
            分类:
            <select class="form-control" name="category" style="width: 140px;">
            <option value='0'>全部</option>
            <volist name="category_tree" id="vo">
                 <option value='{$vo.id}' {$category==$vo.id?'selected':''}>{$vo.name}</option>
            </volist>
        </select>&nbsp;&nbsp; 品牌:
            <select class="form-control" name="brand" style="width: 140px;">
            <option value='0'>全部</option>
            <volist name="brands" id="vo">
                 <option value='{$vo.id}' {$brand==$vo.id?'selected':''}>{$vo.name}</option>
            </volist>
        </select>&nbsp;&nbsp; 价格区间:
            <select class="form-control" name="price_range" style="width: 140px;">
            <option value='0'>全部</option>
            <volist name="price_ranges" id="vo">
                 <option value='{$vo.id}' {$price_range==$vo.id?'selected':''}>{$vo.price_range}</option>
            </volist>
        </select>&nbsp;&nbsp; 级别:
            <select class="form-control" name="rank" style="width: 140px;">
            <option value='0'>全部</option>
            <volist name="ranks" id="vo">
                 <option value='{$vo.id}' {$rank==$vo.id?'selected':''}>{$vo.rank}</option>
            </volist>
        </select> &nbsp;&nbsp; 时间:
            <input type="text" class="form-control js-bootstrap-datetime" name="start_time" value="{$start_time|default=''}" style="width: 140px;" autocomplete="off">-
            <input type="text" class="form-control js-bootstrap-datetime" name="end_time" value="{$end_time|default=''}" style="width: 140px;" autocomplete="off"> &nbsp; &nbsp; 关键字:
            <input type="text" class="form-control" name="keyword" style="width: 200px;" value="{$keyword|default=''}" placeholder="请输入关键字...">
            <input type="text" class="form-control" name="id" style="width: 100px;" value="{$ser_car_id|default=''}" placeholder="请输ID">
            <input type="submit" class="btn btn-primary" value="搜索" />
            <a class="btn btn-danger" href="{:url('AdminCar/index')}">清空</a>
        </form>
        <form class="js-ajax-form" action="" method="post">
            <div class="table-actions">
                <notempty name="category">
                    <button class="btn btn-primary btn-sm js-ajax-submit" type="submit" data-action="{:url('AdminCar/listOrder')}">{:lang('SORT')}
                </button>
                </notempty> <button class="btn btn-primary btn-sm js-ajax-submit" type="submit" data-action="{:url('AdminCar/publish',array('yes'=>1))}" data-subcheck="true">发布
            </button>
                <button class="btn btn-primary btn-sm js-ajax-submit" type="submit" data-action="{:url('AdminCar/publish',array('no'=>1))}" data-subcheck="true">取消发布
            </button>
                <button class="btn btn-primary btn-sm js-ajax-submit" type="submit" data-action="{:url('AdminCar/recommend',array('yes'=>1))}" data-subcheck="true">推荐
            </button>
                <button class="btn btn-primary btn-sm js-ajax-submit" type="submit" data-action="{:url('AdminCar/recommend',array('no'=>1))}" data-subcheck="true">取消推荐
            </button>
                <!--
            <notempty name="category">
                <button class="btn btn-primary btn-sm js-cars-move" type="button">批量移动</button>
            </notempty>
            <button class="btn btn-primary btn-sm js-cars-copy" type="button">批量复制</button>
            -->
                <button class="btn btn-danger btn-sm js-ajax-submit" type="submit" data-action="{:url('AdminCar/delete')}" data-subcheck="true" data-msg="您确定删除吗？">
                {:lang('DELETE')}
            </button>
            </div>
            <table class="table table-hover table-bordered table-list">
                <thead>
                    <tr>
                        <th width="15">
                            <label>
                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                    </label>
                        </th>
                        <notempty name="category">
                            <th width="50">{:lang('SORT')}</th>
                        </notempty>
                        <th width="50">ID</th>
                        <th>标题</th>
                        <th width="80">分类</th>
                        <th width="110">基础属性</th>
                        <th width="180">车身</th>
                        <th width="220">发动机</th>
                        <th width="180">传动/驱动</th>
                        <th width="200">底盘</th>
                        <th width="60">点击量</th>
                        <th width="60">缩略图</th>
                        <th width="120">更新时间</th>
                        <th width="50">上架</th>
                        <th width="50">推荐</th>
                        <th width="90">操作</th>
                    </tr>
                </thead>
                <empty name="cars">
                    <td colspan="14" class="text-center"> aOh! 暂时还没有添加汽车! </td>
                </empty>
                <foreach name="cars" item="vo">
                    <tr>
                        <td>
                            <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]" value="{$vo.id}" title="ID:{$vo.id}">
                        </td>
                        <notempty name="category">
                            <td>
                                <input name="list_orders[{$vo.category_id}]" class="input-order" type="text" value="{$vo.list_order}">
                            </td>
                        </notempty>
                        <td><b>{$vo.id}</b></td>
                        <td>
                            <notempty name="category">
                                <a href="{:cmf_url('rental/Car/index',array('id'=>$vo['id'],'cid'=>$vo['category_id']))}" target="_blank">{$vo.title}</a>
                                <else/>
                                <a href="{:cmf_url('rental/Car/index',array('id'=>$vo['id']))}" target="_blank">{$vo.title}</a>
                            </notempty>
                        </td>
                        <td><span class="label label-info">{$vo.categories.name}</span>
                        </td>
                        <td>价格：{$vo.primary.price}万<br/>类型：{$vo.primary.price}<br/>外观：{$vo.primary.exterior}<br/>内视：{$vo.primary.interior}</td>
                        <td>L*W*H(mm):{$vo.bodywork.length}*{$vo.bodywork.width}*{$vo.bodywork.height}<br/>车身结构:{$vo.bodywork.structure}<br/>车身轴距:{$vo.bodywork.wheel_base}mm</td>
                        <td>发动机：{$vo.engine.type}<br/>最大扭矩：{$vo.engine.max_torque}<br/>最大马力：{$vo.engine.max_horsepower}<br/>燃料类型：{$vo.engine.fuel}</td>
                        <td>变速箱：{$vo.drive.gearbox}<br/>驱动方式：{$vo.drive.type}</td>
                        <td>前悬架类型：{$vo.underpan.front_suspension}<br/>后悬架类型:{$vo.underpan.rear_suspension}<br/>车体结构:{$vo.underpan.structure}</td>
                        <td>{$vo.post_hits|default=0}</td>
                        <td>
                            <notempty name="vo.more.thumbnail">
                                <a href="javascript:parent.imagePreviewDialog('{:cmf_get_image_preview_url($vo.more.thumbnail)}');">
                                    <img class="fa fa-fw" src="{:cmf_get_image_preview_url($vo.more.thumbnail)}">
                                </a>
                                <else/>
                                <i class="fa fa-close" title="未上传" style="color: red;"></i>
                            </notempty>
                        </td>
                        <td>
                            <notempty name="vo.update_time">
                                {:date('Y-m-d H:i',$vo['update_time'])}
                            </notempty>
                        </td>
                        <td style="text-align: center;">
                            <notempty name="vo.post_status">
                                <i class="fa fa-check" title="已上架" style="color: #18BC9C;"></i>
                                <else/>

                                <i class="fa fa-close" title="未上架" style="color: red;"></i>
                            </notempty>
                        </td>
                        <td style="text-align: center;">
                            <notempty name="vo.recommended">
                                <i class="fa fa-check" title="已推荐" style="color: #18BC9C;"></i>
                                <else/>
                                <i class="fa fa-close" title="未推荐" style="color: red;"></i>
                            </notempty>
                        </td>
                        <td>
                            <a href="{:url('AdminCar/edit',array('id'=>$vo['id']))}">{:lang('EDIT')}</a>
                            <a href="{:url('AdminCar/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>
                        </td>
                    </tr>
                </foreach>
            </table>

            <ul class="pagination">{$page|default=''}</ul>
        </form>
    </div>
    <script src="__STATIC__/js/admin.js"></script>
    <script>
        function reloadPage(win) {
            win.location.reload();
        }

        $(function() {
            setCookie("refersh_time", 0);
            Wind.use('ajaxForm', 'artDialog', 'iframeTools', function() {
                //批量复制
                $('.js-cars-copy').click(function(e) {
                    var ids = [];
                    $("input[name='ids[]']").each(function() {
                        if ($(this).is(':checked')) {
                            ids.push($(this).val());
                        }
                    });

                    if (ids.length == 0) {
                        art.dialog.through({
                            id: 'error',
                            icon: 'error',
                            content: '您没有勾选信息，无法进行操作！',
                            cancelVal: '关闭',
                            cancel: true
                        });
                        return false;
                    }

                    ids = ids.join(',');
                    art.dialog.open("__ROOT__/index.php?g=rental&m=AdminCar&a=copy&ids=" + ids, {
                        title: "批量复制",
                        width: "300px"
                    });
                });
                //批量移动
                $('.js-cars-move').click(function(e) {
                    var ids = [];
                    $("input[name='ids[]']").each(function() {
                        if ($(this).is(':checked')) {
                            ids.push($(this).val());
                        }
                    });

                    if (ids.length == 0) {
                        art.dialog.through({
                            id: 'error',
                            icon: 'error',
                            content: '您没有勾选信息，无法进行操作！',
                            cancelVal: '关闭',
                            cancel: true
                        });
                        return false;
                    }

                    ids = ids.join(',');
                    art.dialog.open("__ROOT__/index.php?g=rental&m=AdminCar&a=move&old_term_id={$term.term_id|default=0}&ids=" + ids, {
                        title: "批量移动",
                        width: "300px"
                    });
                });
            });
        });
    </script>
</body>

</html>